#ifndef CLIENT_H_
#define	CLIENT_H_

#define _HDB_ "rooms.db"
#define _FREE_		0
#define _BOOKED_	1
#define _OCCUPIED_	2

#define MAX_NAME 80
#define MAX_TIME 60

/* number of rooms a guest can reserve */
#define MAX_RROOM 30

/* total number of rooms in the hotel */
#define MAX_ROOM  300
 

typedef struct room {
	int status;
	char guest[MAX_NAME];
	char occupied[MAX_TIME];
} roomT;

typedef struct header {
	int roomsQty;
	int oRooms;
	int rRooms;
} headerT;

/**
 ** Locks the header and the database area corresponding to the room number 
 ** entered. If room == 0 then the entire database is locked.
 **
 **	@param	fd		The file descriptor of the database for HotelDB.
 **	@param	rorw	_WRITE_ to create a lock for writing or _READ_ for a lock 
 **					for reading.
 **	@param	room	The number of room to be locked. (0 means the whole database)
 **	@return			Returns -1 on error or 1 if the lock was applied.
 **
 **/
int lockFile(int fd, int rorw, int room);

/**
 ** Unlocks the header and the database area corresponding to the room number 
 ** entered. If room == 0 then the entire database is unlocked.
 **
 **	@param	fd		The file descriptor of the database for HotelDB.
 **	@param	room	The number of room to be locked.(0 means the whole database)
 **	@return			Returns -1 on error or 1 if it was unlocked successfully.
 **
 **/
int unlockFile(int fd, int room);

#endif

